/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include <QSettings>
#include "boardsettingsdialog.h"

BoardSettingsDialog::BoardSettingsDialog(Wishmaster::Board* board, QWidget* parent) : QDialog(parent), m_board(board)
{
	m_ui.setupUi(this);

	Q_ASSERT(board);
	
	QSettings settings;
	QVariant override = board->property("override");
	if(override.isValid() && override.toBool())
	{
		m_ui.cb_override->setChecked(true);
		m_ui.cb_indexOnly->setChecked(board->property("indexonly").toBool());
		m_ui.sb_refreshInterval->setValue(board->property("refreshinterval").toInt());
		m_ui.cb_doNotRefresh->setChecked(board->property("donotrefresh").toBool());
	}
}

BoardSettingsDialog::~BoardSettingsDialog()
{
}

void BoardSettingsDialog::accept()
{
	m_board->setProperty("override", m_ui.cb_override->isChecked());
	m_board->setProperty("indexonly", m_ui.cb_indexOnly->isChecked());
	m_board->setProperty("refreshinterval", m_ui.sb_refreshInterval->value());
	m_board->setProperty("donotrefresh", m_ui.cb_doNotRefresh->isChecked());
	QDialog::accept();
}

